package FactoryPackage;
import Pro.Apple;
import Pro.Banana;
import Pro.MyFruit;
import Pro.MyFruitStore;

public class Client {
    public static void main(String[] args){
        MyFruit fru1=new Apple();
        MyFruit fru2=new Banana();
        MyFruitStore mfs=MyFruitStore.Getfruitstore();
        mfs.Add(1,fru1);
        mfs.Add(2,fru2);
        mfs.Add(3,new Apple());
        mfs.Add(4,new Banana());
        //MyFruitStore mfs2=MyFruitStore.Getfruitstore();
        MyFruit fru=(MyFruit)mfs.Get(4);
        fru.Display();
        System.out.println("mfs1:"+mfs.toString());
        //System.out.println("mfs2:"+mfs.toString());

        //MyFruit fru1=new Apple();
        //MyFruit fru2=(Apple)fru1.clone();
        //fru1.Display();
        //fru2.Display();
        //System.out.println("fru1:"+fru1.hashCode());
        //System.out.println("fru2:"+fru2.hashCode());

        //Factory factory = new AFactory();
        //Fruit fruit=factory.CreateFruit();
        //fruit.eat();
    }
    public String factory(String fruitname)
    {
        if(fruitname.equals("Apple")){
            return("Apple");
        }
        else if(fruitname.equals("Banana")){
            return("Banana");
        }
        else
        {
            return null;
        }
    }
}
